from . import api
from flask import request, json


# 获取请求数据 后续考虑兼容非json格式数据，接收到非json格式数据报错
@api.route("/", methods=['POST'])
def handler_request():
    print(request.method)
    if request.method == 'POST':
        data = request.json
        # json数据是字典数据
        package_name = data["packageName"]
        terminal_no = data["terminalNo"]
        log_type = data["type"]
        logger_event_list = data["loggerEventList"]
        print(package_name)
        print(terminal_no)
        print(log_type)
        print(logger_event_list)
        # 变量元组
        for logger_event in logger_event_list:
            print(logger_event)
    return 'Hello World!'

